import dynamicComponent from '../utils/dynamicComponent'
import BaseLayout from '../layout/BaseLayout/index';

const routes = [
    {
        path:'/login',
        component:dynamicComponent(
            ['testList'],
            () => import('../routes/Login')
        ),
    },
    {
        path:'/',
        component:BaseLayout,
        children:[
            {
                path:'/index/page',
                component:dynamicComponent(
                    ['testList'],
                    () => import('../routes/IndexPage')
                ),
                meta:{
                    title:'首页'
                }
            },
            {
                path:'/question',
                meta:{
                    title:"试题管理"
                },
                children:[
                    {
                        path: '/question/list',
                        component: dynamicComponent(['questions'], () => import('@/routes/Questions/List')),
                        meta: {
                          title: '试题列表'
                        }
                    },
                    {
                        path: '/question/addlist',
                        component: dynamicComponent(['questions'], () => import('../routes/Questions/Addlist')),
                        meta: {
                          title: '添加试题'
                        }
                    },
                ]
            },
            {
                path: '/class',
                meta: {
                    title: '班级管理'
                },
                children: [
                    {
                        path: '/class/classmanager',
                        component: dynamicComponent(['classmanagemeng'], () => import('@/routes/Class/Class_manager')),
                        meta: {
                            title: '班级管理'
                        }
                    },
                    {
                        path: '/class/classroom',
                        component: dynamicComponent(['classroom'], () => import('@/routes/Class/Classroom')),
                        meta: {
                            title: '教室管理'
                        }
                    },
                    {
                        path: '/class/student',
                        component: dynamicComponent(['student'], () => import('../routes/Class/Student')),
                        meta: {
                            title: '学生管理'
                        }
                    },
                ]
            },
            {
                path:'/repository',
                meta:{
                    title:"知识库管理"
                },
                children:[
                    {                
                        path:"/repository/create",
                        component: dynamicComponent(['repository'], () => import('../routes/Repository/Create')),
                    },
                    {
                        path: '/repository/interview',
                        component: dynamicComponent(['repository'], () => import('../routes/Repository/Interview')),
                        meta: {
                          title: '面试题管理'
                        },
                    },
                    {
                        path: '/repository/knowledge',
                        component: dynamicComponent(['repository'], () => import('../routes/Repository/Knowledge')),
                        meta: {
                          title: '知识点管理'
                        }
                    },
                    {
                        path: '/repository/check',
                        component: dynamicComponent(['repository'], () => import('../routes/Repository/Check')),
                        meta: {
                          title: '查看试题'
                        }
                    },
                ]
            },
            {
                path:'/test/list',
                component:dynamicComponent(
                    ['testList'],
                    () => import('../routes/TestList')
                ),
                meta:{
                    title:'测试页面'
                }
            },
            {
                path:'/user',
                component:dynamicComponent(
                    ['testList'],
                    () => import('../routes/TestList')
                ),
                meta:{
                    title:'用户管理'
                },
                children:[
                    {
                        path:'/user/list',
                        component:dynamicComponent(
                            ['testList'],
                            () => import('../routes/TestList')
                        ),
                        meta:{
                            title:'用户列表'
                        },
                    },
                    {
                        path:'/user/char',
                        component:dynamicComponent(
                            ['testList'],() => import('../routes/TestList')
                        ),
                        meta:{
                            title:'用户统计'
                        },
                    }
                ]
            },
             {
                path: "/exam",
                meta: {
                    title: '考试管理'
                },
                children: [
                    {
                        path: '/exam/list',
                        component: dynamicComponent(
                            ['exam'], () => import('../routes/Exam/ExamList')
                        ),
                            meta: {
                            title: '试卷列表'
                        },
                    },{
                        path: '/exam/add',
                        component: dynamicComponent(
                            ['exam'], () => import('../routes/Exam/ExamAdd')
                        ),
                            meta: {
                            title: '添加试卷'
                        },
                    },{
                        path: '/exam/detail',
                        component: dynamicComponent(
                            ['exam'], () => import('../routes/Exam/ExamDetail')
                        ),
                            meta: {
                            title: '试卷详情'
                        },
                    }
                ]
            }
        ]
    }
]

export const getMenuConfig = () =>{
    return routes[routes.length - 1].children
}

export default routes